const { contextBridge, ipcRenderer } = require('electron')
const { }


const baseServiceIPC = require("./baseServiceRepload")
const userServiceIPC = require("./userServiceRepload")


exports.initIPC = function () {
    const services = [baseServiceIPC, userServiceIPC]
    for (var service of services) {
        for (var i in service) {
            service[i]()
        }
    }
}


exports.initPreload = function () {

}
contextBridge.exposeInMainWorld('appBridge', {
    userConfig: {
        getSlogan: (request) => {
            return ipcRenderer.sendSync('userConfig.getSlogan', request)
        },
        getAvatar: (request) => {
            return ipcRenderer.sendSync('userConfig.getAvatar', request)
        }
    },

    baseService: {
        search: (request) => {
            return ipcRenderer.sendSync('baseService.search', request)
        },
        runPlugin: (request) => {
            return ipcRenderer.sendSync('baseService.runPlugin', request)
        },
        runSysPluginByName: (request) => {
            return ipcRenderer.send('baseService.runSysPluginByName', request)
        },
        switchHide: (request) => {
            ipcRenderer.send('baseService.switchHide', request)
        },

    }
})




